<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\TaskLevel;
use App\Traits\Controllers\AdminTraits;
use App\Transformers\TaskLevelTransFormer;
use Illuminate\Http\Request;

class TaskLevelController extends Controller
{
   use AdminTraits;
   public $model = TaskLevel::class;

   public $transformer  = TaskLevelTransFormer::class;

    /**
     * 参数验证规则
     *
     * @param Request $request
     * @return array
     */
    public function rules(Request $request): array
    {
        switch ($request->method()) {
            case 'GET':
                return [];
                break;
            case 'POST':
            case 'PUT':
            case 'PATCH':
                return [
                    'task_name' => 'required',
                    'task_type' => 'required',
                    'limit_num' => 'required',
                    'sort' => 'required',


                ];
                break;

        }
        return [];
    }

    /**
     * 验证信息
     *
     * @return array
     */
    public function ruleMessages(): array
    {
        return [
            'task_name.required' => '任务名称不能为空',
            'task_type.required' => '任务类型不能为空',
            'limit_num.required' => '等级不能为空',
            'sort.required' => '排序不能为空',


        ];
    }
}
